/* 
 *  Incub - incubate your baby robot
 *  Copyright (C) 2008 Stanislaw Szymczyk
 *  e-mail: sszymczy@gmail.com   www: http://cogville.cog-lab.com
 *
 *  This file is part of Incub.
 *
 *  Incub is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  Incub is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Incub.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
 
#include "Entity.h"

using std::string;
using std::vector;

Entity::Entity() {
	still = false;
	parentJoint = NULL;
}

void Entity::setName(string& name) {
	this->name = name;
}

string& Entity::getName() {
	return name;
}

void Entity::addShape(Shape* e) {
	shapes.push_back(e);
}

vector<Shape*>& Entity::getShapes() {
	return shapes;
}

void Entity::addJoint(Joint* j) {
	j->setParentEntity(this);
	joints.push_back(j);
}

vector<Joint*>& Entity::getJoints() {
	return joints;
}

void Entity::addSensor(Sensor* j) {
	j->setParentEntity(this);
	sensors.push_back(j);
}

vector<Sensor*>& Entity::getSensors() {
	return sensors;
}

void Entity::setStill(string& s) {
	if(s == "true") still = true;
	else still = false; 
}

bool Entity::getStill() {
	return still;
}

void Entity::setParentJoint(Joint *parentJoint) {
	this->parentJoint = parentJoint;
}

Joint* Entity::getParentJoint() {
	return parentJoint;
}

Entity::~Entity() {
	for(vector<Shape*>::iterator shape = shapes.begin(); shape != shapes.end(); shape++) {
		delete *shape;
	}	
	for(vector<Sensor*>::iterator sensor = sensors.begin(); sensor != sensors.end(); sensor++) {
		delete *sensor;
	}
	for(vector<Joint*>::iterator joint = joints.begin(); joint != joints.end(); joint++) {
		delete *joint;
	}	
}
